<?php

namespace App\Abstracts;

/**
 * Class TemplateAbstract
 * @package App\Abstracts
 */
abstract class TemplateAbstract
{
    /**
     * @author Jerry
     * @param array $data
     * @return mixed
     */
    abstract public function handle(array $data);

    /**
     * 排序
     * Created by Jerry
     * @param $data
     * @param string $sortKey
     * @return mixed
     */
    protected static function checkDataSort(array $data, $sortKey = 'sort')
    {
        $sort = array();

        foreach ($data as $key => $value) {
            $sort[] = $value[$sortKey];
        }

        array_multisort($sort, SORT_DESC, $data);

        return $data;
    }

}